//定义一些变量
// var url = "";
// function buildDetailUrl(detailUrl) {
//     url = detailUrl;
// }
// var doc1 = '<li class="layui-col-sm12 layui-col-md6"><div class="fly-extend-list layui-card"><div class="fly-extend-list-header"><h2 class="fly-extend-title layui-elip"><a href="';
// var doc2 = '"></a></h2><div class="fly-extend-list-info"><a href="" target="_blank" class="fly-extend-list-user"> <cite class="layui-hide-xs">';
// var doc3 = '</cite></a></div></div><div style="margin-bottom: 5px;margin-top: -1px;">';
//
// var doc5 = '</div><a href="';
// var doc5_1 = '" target="_blank"><p class="fly-extend-list-desc">';
// var doc6 = '</p></a></div></li>';

var tab1 = '<li class="layui-nav-item"><a href="/login.html">登入</a></li><li class="layui-nav-item"><a href="/reg.html">注册</a></li>';
var tab2 = '<li class="layui-nav-item2" onclick="show()"><a class="fly-nav" href="javascript:;" style="color: aliceblue;"><cite class="layui-hide-xs">';
var tab3 = '</cite></a><dl class="layui-nav-child" onmouseover="show()" onmouseout="hide()"><dd><a href="/mydoc.html"><i class="layui-icon">&#xe620;</i>基本设置</a></dd><hr style="margin: 5px 0;"><dd><a onclick="logout()" style="text-align: center;">退出</a></dd></dl></li>';
var doc4 = '<div onclick="labelSearch(this)" class="layui-badge layui-bg-green layui-hide-xs label">';
var doc4_1 = '</div>';

function buildHtml(id,title,description,userName,labels) {
    var labelHtml = "";
    labels.forEach(function (label){
        labelHtml+=(doc4+label+doc4_1)
    });
    var html =  '<li class="layui-col-sm12 layui-col-md6">\n' +
                '    <div class="fly-extend-list layui-card">\n' +
                '        <div class="fly-extend-list-header">\n' +
                '            <h2 class="fly-extend-title layui-elip"><a href="/detail/'+id+'">'+title+'</a></h2>\n' +
                '            <div class="fly-extend-list-info">\n' +
                '                <a target="_blank" class="fly-extend-list-user"> <cite class="layui-hide-xs">'+userName+'</cite></a>\n' +
                '            </div>\n' +
                '        </div>\n' +
                '        <div style="margin-bottom: 5px;margin-top: -1px;">\n' + labelHtml +
                '        </div>\n' +
                '        <a href="/detail/'+id+'" target="_blank"><p class="fly-extend-list-desc">'+description+'</p></a>\n' +
                '    </div>\n' +
                '</li>\n';
    return html;
}

function buildHtml2(id,title,createTime) {
    var html =  '<li>\n' +
                '  <a class="jie-title" href="/detail/'+id+'" target="_blank">'+title+'</a>\n' +
                '  <i>'+createTime+'</i>\n' +
                '  <a class="mine-edit" href="/update/'+id+'">编辑</a>\n' +
                '</li>';
    return html;
}

